<extend name="Public/base" />

<block name="body">
	<!-- 标题栏 -->
	<div class="am-cf am-u-md-12 header-title">
		<h2>插件列表</h2>
	</div>
	<div class="am-cf am-u-md-12 am-margin-top">
		<a href="{:U('create')}" class="am-btn am-btn-primary">快速创建</a>
	</div>

	<!-- 数据列表 -->
	<div class="am-cf am-u-md-12 am-margin-top">
		<table class="am-table am-table-striped ">
			<thead>
				<tr>
					<th>名称</th>
					<th>标识</th>
					<th >描述</th>
					<th width="80px">状态</th>
					<th>作者</th>
					<th width="80px">版本</th>
					<th >操作</th>
				</tr>
			</thead>
			<tbody>
				<notempty name="_list">
				<volist name="_list" id="vo">
				<tr>
					<td>{$vo.title}</td>
					<td>{$vo.name}</td>
					<td>{$vo.description}</td>
					<td>{$vo.status_text|default="未安装"}</td>
					<td><a target="_blank" href="{$vo.url|default='http://www.ocenter.cn/'}">{$vo.author}</a></td>
					<td>{$vo.version}</td>
					<td>
						<if condition="!$vo['uninstall']">
						<php>
							$class	= get_addon_class($vo['name']);
							if(!class_exists($class)){
								$has_config = 0;
							}else{
								$addon = new $class();
								$has_config = count($addon->getConfig());
							}
						</php>
						<if condition="$has_config">
							<a href="{:U('config',array('id'=>$vo['id']))}">设置</a>
						</if>
						<if condition="$vo['status'] egt 0">
							<eq name="vo.status" value="0">
								&nbsp;<a class="ajax-get" href="{:U('enable',array('id'=>$vo['id']))}">启用</a>
							<else />
								&nbsp;<a class="ajax-get" href="{:U('disable',array('id'=>$vo['id']))}">禁用</a>
							</eq>
							&nbsp;<a class="ajax-get" href="{:U('uninstall?id='.$vo['id'])}">卸载</a>
						</if>
						<else/>
						&nbsp;<a class="ajax-get" href="{:U('install?addon_name='.$vo['name'])}">安装</a>
						</if>
					</td>
				</tr>
				</volist>
				<else/>
				<td colspan="7" class="text-center"> aOh! 暂时还没有内容! </td>
				</notempty>
			</tbody>
		</table>
	</div>
	<!-- 分页 -->
    <div class="am-cf am-u-md-12">
        {$_page}
    </div>
</block>
